#include "permanentcard.h"
#include <QDebug>

PermanentCard::PermanentCard(QDomDocument *xmlDefinition):
        AbstractCard(xmlDefinition)
{
    QDomNodeList nodes = xmlDefinition->elementsByTagName(WORD_PRICE);
    if (nodes.isEmpty())
        return;

    QDomDocument price(WORD_PRICE);
    price.appendChild(nodes.item(0).cloneNode());

    m_PriceBase = price.toString();
}

void PermanentCard::AddAbility(QString newAbility)
{
    if (qFind(m_Abilities, newAbility) != m_Abilities.end())
        m_Abilities.append(newAbility);
}

void PermanentCard::RemoveAbility(QString removedAbility)
{
    typeof(m_Abilities.constBegin()) it = qFind(m_Abilities, removedAbility);
    if (it != m_Abilities.constEnd())
        m_Abilities.removeAt(it - m_Abilities.constBegin());

}

